package com.freesky.biz.abchina.controller;

import com.freesky.biz.abchina.domain.TRightsLogEntity;
import com.freesky.biz.abchina.service.IRightsLogService;
import com.freesky.common.annotation.Log;
import com.freesky.common.core.controller.BaseController;
import com.freesky.common.core.domain.AjaxResult;
import com.freesky.common.core.page.TableDataInfo;
import com.freesky.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/abchina/rights/log")
public class RightsLogController extends BaseController {

    @Autowired
    private IRightsLogService rightsLogService;


    @PreAuthorize("@ss.hasPermi('abchina:rightslog:list')")
    @GetMapping("/list")
    public TableDataInfo list(TRightsLogEntity entity) {
        startPage();
        List<TRightsLogEntity> list = rightsLogService.findList(entity);
        return getDataTable(list);
    }

    @Log(title = "信用卡权益", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('abchina:rightslog:export')")
    @GetMapping("/export")
    public AjaxResult export(TRightsLogEntity entity,
                             HttpServletResponse response) {
        return rightsLogService.exportFile(entity);
    }


}
